package com.mall.controller;

import com.mall.beans.ShoppingCart;
import com.mall.service.ShoppingCartService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 购物车表(ShoppingCart)表控制层
 *
 * @author 周彭
 * @since 2020-12-22 09:33:57
 */
@RestController
@RequestMapping("shoppingCart")
public class ShoppingCartController {
    /**
     * 服务对象
     */
    @Resource
    private ShoppingCartService shoppingCartService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public ShoppingCart selectOne(Integer id) {
        return this.shoppingCartService.queryById(id);
    }

    /**
     * 查询所有数据
     *
     */
    @GetMapping("all")
    public List<ShoppingCart> all(Integer id) {
        return this.shoppingCartService.all();
    }

}